<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
define('NOSESSION',true);
require_once '../../core/core.php';
define('NO_ERROR_RETURN',true);
define('JSAPI',true);
//其他会员一键登录
if($_GET['i']){
	$_SESSION['uniacid']=$_GET['i'];
	unset($_GET['i']);
	$basic=plugin('jy_kuaidisys')->plugin_setting('basic');
	if(!$basic['key']){
		exit('基本设置-接口密钥未保存！');
	}
}else{
	exit('访问异常！');
}
if($_GET['waybill'] && $_GET['shopbill']){
	if($_GET['type'] && $_GET['shopbill']){
		$update=array(
			'kdtype'=>$_GET['type']
		);
		$jilog=pdo_get('jy_kuaidisys_jilog',array('uniacid'=>$_SESSION['uniacid'],'waybill'=>$_GET['shopbill']));
		if($jilog['weight'] !=$_GET['calWeight'] && $_GET['calWeight']){
			$update['weight']=$_GET['calWeight'];
		}
		if($jilog['koufee'] !=$_GET['freight'] && $_GET['freight']){
			$addfee=$basic['addfee']?:0;
			if(substr($addfee,-1)=='%'){
				$addfee=($_GET['freight']*substr($addfee,0,-1))/100;
				$addfee=intval($addfee*100)/100;
			}
			$update['endfee']=$_GET['freight']+$addfee;
			$update['koufee']=$_GET['freight'];
			$update['bufee']=$update['endfee']-$jilog['money'];
			if($update['bufee']<=0){
				unset($update['bufee']);
				unset($update['endfee']);
			}
			$update['status']=8;
		}
		if($_GET['type']=='正常签收'){
			$update['status']=3;
			model('jy_kuaidisys/commission')->order_complete($jilog);
		}
		pdo_update('jy_kuaidisys_jilog'$update,array('uniacid'=>$_SESSION['uniacid'],'waybill'=>$_GET['shopbill']));
	}
	$res=array('code'=>1,'message'=>'推送成功');
	$res=ijson_encode($res);
	exit($res);
}else{
	exit('参与异常！');
}